home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 276-300 / 285 / plasma / ehbplasma.c < prev    next >
C/C++ Source or Header  |  1995-03-14  |  16KB  |  595 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5. #include <proto/exec.h>
  6. #ifdef CPU020
  7. #include <exec/execbase.h>
  8. #endif
  9. #include <proto/intuition.h>
  10. #include <proto/graphics.h>
  11. #include <time.h>
  12. #include <proto/dos.h>
  13. #define HEIGHT 400L
  14. #define DEPTH 6
  15. #define WIDTH 320L
  16. #define rowoffset (WIDTH/8)
  17. #define MODULUS (0x20000L)
  18. #define C 13849
  19. #define A 25173
  20. #define randu2(x) (((seed = seed*A+C))%(x))
  21. #define unmap(x) (randu2(6)+rev_array[(x)])
  22. #ifdef LATTICE
  23. #define PROTOTYPES 1
  24. #endif
  25.  
  26. #ifndef LATTICE
  27. #define __regargs
  28. #endif
  29.  
  30. #ifdef DEBUG
  31. int temparray[64];
  32. #endif
  33.  
  34. /*************************************************
  35. /*
  36. /* This code © 1989 by W. Roger uzun
  37. /* This code is for Lattice 5.0X
  38. /* compile using - lc -v -cf -L -O -w EHBPlasma (for 68000 version)
  39. /* or lc -v -cf -L -m2 -O -dCPU020 -w EHBPlasma (for 68020 version)
  40. /*
  41. /*************************************************/
  42.  
  43. #define WINDOWSIGNAL (1L<<(wG->UserPort->mp_SigBit))
  44.  
  45. #define PaletteColorCount 32
  46.  
  47. short nplanes = DEPTH;
  48. UBYTE *bp[DEPTH];
  49. short ytable[HEIGHT];
  50.  
  51. struct TextFont *myTextFont;
  52.  
  53. struct RastPort *rpG;
  54.  
  55. struct TextAttr TOPAZ80 = {
  56.     (STRPTR)"topaz.font",
  57.     TOPAZ_EIGHTY,0,0
  58. };
  59. struct NewScreen NewScreenStructure = {
  60.     0,0,    /* screen XY origin relative to View */
  61.     320,HEIGHT,    /* screen width and height */
  62.     6,    /* screen depth (number of bitplanes) */
  63.     0,1,    /* detail and block pens */
  64.     LACE+EXTRA_HALFBRITE,    /* display modes for this screen */
  65.     CUSTOMSCREEN,    /* screen type */
  66.     &TOPAZ80,    /* pointer to default screen font */
  67.     "Plasma",    /* screen title */
  68.     NULL,    /* first in list of custom screen gadgets */
  69.     NULL    /* pointer to custom BitMap structure */
  70. };
  71.  
  72. #define NEWSCREENSTRUCTURE NewScreenStructure
  73.  
  74. USHORT Palette[] = {
  75.     0x000,    /* color #0 */
  76.     0x01f,    /* color #1 */
  77.     0x03d,    /* color #2 */
  78.     0x05b,    /* color #3 */
  79.     0x079,    /* color #4 */
  80.     0x097,    /* color #5 */
  81.     0x0a5,  /* color #6 */
  82.     0x0b4,  /* color #7 */
  83.     0x0c3,  /* color #8 */
  84.     0x0e1,  /* color #9 */
  85.     0x0f0,  /* color #10 */
  86.  
  87.     0x01f0,    /* color #11 */
  88.     0x03d0,    /* color #12 */
  89.     0x05b0,    /* color #13 */
  90.     0x0790,    /* color #14 */
  91.     0x0970,    /* color #15 */
  92.     0x0a50,    /* color #16 */
  93.     0x0B40,    /* color #17 */
  94.     0x0c30,    /* color #18 */
  95.     0x0e10,    /* color #19 */
  96.     0x0f00,    /* color #20 */
  97.  
  98.     0x0f01,    /* color #21 */
  99.     0x0d03,    /* color #22 */
  100.     0x0b05,    /* color #23 */
  101.     0x0907,    /* color #24 */
  102.     0x0709,    /* color #25 */
  103.     0x050a,    /* color #26 */
  104.     0x040b,    /* color #27 */
  105.     0x030c,    /* color #28 */
  106.     0x020d,    /* color #29 */
  107.     0x010e,    /* color #30 */
  108.     0x000f  /* color #31 */
  109. };
  110.  
  111. #define PALETTE Palette
  112.  
  113. struct IntuiText IText1 = {
  114.     3,1,JAM1,    /* front and back text pens, drawmode and fill byte */
  115.     0,0,    /* XY origin relative to container TopLeft */
  116.     &TOPAZ80,    /* font pointer or NULL for default */
  117.     "Quit",    /* pointer to text */
  118.     NULL    /* next IntuiText structure */
  119. };
  120.  
  121. struct MenuItem MenuItem2 = {
  122.     NULL,    /* next MenuItem structure */
  123.     0,8,    /* XY of Item hitbox relative to TopLeft of parent hitbox */
  124.     80,8,    /* hit box width and height */
  125.     ITEMTEXT+COMMSEQ+ITEMENABLED+HIGHCOMP,    /* Item flags */
  126.     0,    /* each bit mutually-excludes a same-level Item */
  127.     (APTR)&IText1,    /* Item render  (IntuiText or Image or NULL) */
  128.     NULL,    /* Select render */
  129.     'Q',    /* alternate command-key */
  130.     NULL,    /* SubItem list */
  131.     MENUNULL    /* filled in by Intuition for drag selections */
  132. };
  133.  
  134. struct IntuiText IText2 = {
  135.     3,1,JAM1,    /* front and back text pens, drawmode and fill byte */
  136.     0,0,    /* XY origin relative to container TopLeft */
  137.     &TOPAZ80,    /* font pointer or NULL for default */
  138.     "About",    /* pointer to text */
  139.     NULL    /* next IntuiText structure */
  140. };
  141.  
  142. struct MenuItem MenuItem1 = {
  143.     &MenuItem2,    /* next MenuItem structure */
  144.     0,0,    /* XY of Item hitbox relative to TopLeft of parent hitbox */
  145.     80,8,    /* hit box width and height */
  146.     ITEMTEXT+COMMSEQ+ITEMENABLED+HIGHCOMP,    /* Item flags */
  147.     0,    /* each bit mutually-excludes a same-level Item */
  148.     (APTR)&IText2,    /* Item render  (IntuiText or Image or NULL) */
  149.     NULL,    /* Select render */
  150.     'A',    /* alternate command-key */
  151.     NULL,    /* SubItem list */
  152.     MENUNULL    /* filled in by Intuition for drag selections */
  153. };
  154.  
  155. struct Menu Menu1 = {
  156.     NULL,    /* next Menu structure */
  157.     0,0,    /* XY origin of Menu hit box relative to screen TopLeft */
  158.     63,0,    /* Menu hit box width and height */
  159.     MENUENABLED,    /* Menu flags */
  160.     "Project",    /* text of Menu name */
  161.     &MenuItem1    /* MenuItem linked list pointer */
  162. };
  163.  
  164. #define MenuList1 Menu1
  165.  
  166. struct NewWindow NewWindowStructure1 = {
  167.     0,0,    /* window XY origin relative to TopLeft of screen */
  168.     320,HEIGHT,    /* window width and height */
  169.     4,8,    /* detail and block pens */
  170.     VANILLAKEY|MENUPICK,    /* IDCMP flags */
  171.     SMART_REFRESH+BACKDROP+BORDERLESS+ACTIVATE,    /* other window flags */
  172.     NULL,    /* first gadget in gadget list */
  173.     NULL,    /* custom CHECKMARK imagery */
  174.     " ",    /* window title */
  175.     NULL,    /* custom screen pointer */
  176.     NULL,    /* custom bitmap */
  177.     5,5,    /* minimum width and height */
  178.     -1,-1,    /* maximum width and height */
  179.     CUSTOMSCREEN    /* destination screen type */
  180. };
  181.  
  182. SHORT BorderVectors1[] = {
  183.     0,0,
  184.     51,0,
  185.     51,41,
  186.     0,41,
  187.     0,0
  188. };
  189. struct Border Border1 = {
  190.     -1,-1,    /* XY origin relative to container TopLeft */
  191.     3,0,JAM1,    /* front pen, back pen and drawmode */
  192.     5,    /* number of XY vectors */
  193.     BorderVectors1,    /* pointer to XY vectors */
  194.     NULL    /* next border in list */
  195. };
  196.  
  197. struct IntuiText IText3 = {
  198.     3,0,JAM2,    /* front and back text pens, drawmode and fill byte */
  199.     15,17,    /* XY origin relative to container TopLeft */
  200.     NULL,    /* font pointer or NULL for default */
  201.     "OK",    /* pointer to text */
  202.     NULL    /* next IntuiText structure */
  203. };
  204.  
  205. struct Gadget Gadget1 = {
  206.     NULL,    /* next gadget */
  207.     65,217,    /* origin XY of hit box relative to window TopLeft */
  208.     50,40,    /* hit box width and height */
  209.     NULL,    /* gadget flags */
  210.     RELVERIFY,    /* activation flags */
  211.     BOOLGADGET,    /* gadget type flags */
  212.     (APTR)&Border1,    /* gadget border or image to be rendered */
  213.     NULL,    /* alternate imagery for selection */
  214.     &IText3,    /* first IntuiText structure */
  215.     NULL,    /* gadget mutual-exclude long word */
  216.     NULL,    /* SpecialInfo structure */
  217.     NULL,    /* user-definable data */
  218.     NULL    /* pointer to user-definable data */
  219. };
  220.  
  221. #define GadgetList2 Gadget1
  222.  
  223. struct IntuiText IText5 = {
  224.     3,0,JAM2,    /* front and back text pens, drawmode and fill byte */
  225.     40,114,    /* XY origin relative to container TopLeft */
  226.     NULL,    /* font pointer or NULL for default */
  227.     "By Roger Uzun",    /* pointer to text */
  228.     NULL    /* next IntuiText structure */
  229. };
  230.  
  231. struct IntuiText IText4a = {
  232.     3,0,JAM2,    /* front and back text pens, drawmode and fill byte */
  233.     16,61,    /* XY origin relative to container TopLeft */
  234.     NULL,    /* font pointer or NULL for default */
  235.     "Press 'C' to Cycle",    /* pointer to text */
  236.     &IText5    /* next IntuiText structure */
  237. };
  238.  
  239. struct IntuiText IText4 = {
  240.     3,0,JAM2,    /* front and back text pens, drawmode and fill byte */
  241.     6,21,    /* XY origin relative to container TopLeft */
  242.     NULL,    /* font pointer or NULL for default */
  243.     "EHBPlasma Version 1.f",    /* pointer to text */
  244.     &IText4a    /* next IntuiText structure */
  245. };
  246.  
  247.  
  248. struct NewWindow NewWindowStructure3 = {
  249.     70,30,    /* window XY origin relative to TopLeft of screen */
  250.     180,280,    /* window width and height */
  251.     0,1,    /* detail and block pens */
  252.     GADGETUP,    /* IDCMP flags */
  253.     SIMPLE_REFRESH+ACTIVATE+NOCAREREFRESH,    /* other window flags */
  254.     &Gadget1,    /* first gadget in gadget list */
  255.     NULL,    /* custom CHECKMARK imagery */
  256.     " ",    /* window title */
  257.     NULL,    /* custom screen pointer */
  258.     NULL,    /* custom bitmap */
  259.     5,5,    /* minimum width and height */
  260.     -1,-1,    /* maximum width and height */
  261.     CUSTOMSCREEN    /* destination screen type */
  262. };
  263.  
  264.  
  265. struct Screen *sC;
  266. struct Window *wG;
  267. UWORD done=0;
  268.  
  269. long maparray[256]={5,1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,/* 26 */
  270.             7,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,/* 43 */
  271.                     33,33,33,33,33,34,34,34,34,34,35,35,35,35,/* 57 */
  272.             36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,/* 73 */
  273.             40,40,40,40,41,41,41,41,42,42,42,42, /* 85 */
  274.  
  275.             11,11,11,11,11,12,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,/* 26 */
  276.             17,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,/* 43 */
  277.                     43,43,43,43,43,44,44,44,44,44,45,45,45,45,/* 57 */
  278.             46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,/* 73 */
  279.             50,50,50,50,51,51,51,51,52,52,52,52, /* 85 */
  280.  
  281.             21,21,21,21,21,22,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,/* 26 */
  282.             27,27,27,27,27,28,28,28,28,29,29,29,30,30,30,31,31,/* 43 */
  283.                     53,53,53,53,53,54,54,54,54,54,55,55,55,55,/* 57 */
  284.             56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,/* 73 */
  285.             60,60,60,61,61,61,62,62,62,63,63,63 /* 85 */};
  286. long rev_array[64]={    0,
  287.             1,5,9,13,17,21,25,29,33,38,
  288.             86,90,94,98,102,106,110,114,118,123,
  289.             171,175,179,183,187,191,195,199,203,206,
  290.             208,32,
  291.             44,48,52,56,60,64,68,72,76,83,
  292.             129,133,137,141,145,149,153,157,161,165,
  293.             214,218,222,226,230,234,238,242,246,250,
  294.             250};
  295.     
  296. unsigned short seed = 7;
  297.  
  298. #ifdef PROTOTYPES
  299.  
  300. int __regargs ReadPix(long,long);
  301. void __regargs FastPix(long,long,long);
  302. void CycleColors(void);
  303. void __regargs HandleEvent(APTR);
  304. void DoAbout(void);
  305. void DoQuit(void);
  306. void __regargs SubDivide(long,long,long,long);
  307. void __regargs adjust(long,long,long,long,long,long);
  308.  
  309. #endif
  310.  
  311.  
  312. void CycleColors()
  313. {
  314.  ULONG class;
  315.  UWORD d=0,i,temp;
  316.  USHORT tpal[PaletteColorCount];
  317.  struct IntuiMessage *message;
  318.  
  319.  for(i=0;i<PaletteColorCount;i++)
  320.   tpal[i] = Palette[i];
  321.  while (!d)
  322.   {
  323.    temp = tpal[1];
  324.    for(i=2;i<PaletteColorCount;i++)
  325.     {
  326.      tpal[i-1] = tpal[i];
  327.     }
  328.    tpal[(PaletteColorCount-1)] = temp;
  329.    LoadRGB4(&(sC->ViewPort),tpal,PaletteColorCount);
  330.    Delay(6L);
  331.    if ( (message = (struct IntuiMessage *)
  332.     GetMsg(wG->UserPort) ))
  333.     {
  334.     class = message->Class;
  335.     ReplyMsg((struct Message *)message);
  336.     if (class = VANILLAKEY)
  337.      d = 1;
  338.     }
  339.   } 
  340.  LoadRGB4(&(sC->ViewPort),Palette,PaletteColorCount);
  341. }
  342.  
  343. void __regargs adjust(xa,ya,x,y,xb,yb)
  344. long xa,ya,x,y,xb,yb;
  345. {
  346.  long t1,t2;
  347.  int pa,pb,pc,pd;
  348.  register long globalcolor;
  349.  
  350.  if (ReadPix(x,y))
  351.   return;
  352.  pa = xa;
  353.  pb  =xb;
  354.  pc = ya;
  355.  pd = yb;
  356.  globalcolor = randu2(3) * (abs(pa-pb)+abs(pc-pd));
  357.  t1 = unmap(ReadPix(xa,ya));
  358.  t2 = unmap(ReadPix(xb,yb));
  359.  if (!randu2(2))
  360.   {
  361.    globalcolor = -globalcolor;
  362.   }
  363.  globalcolor = ((t1+t2)>>1)+globalcolor;
  364.  globalcolor &= 0xffL;
  365.  globalcolor = maparray[globalcolor];
  366.  FastPix(x,y,globalcolor);
  367. #ifdef DEBUG
  368. temparray[globalcolor]++;
  369. #endif
  370. }
  371.  
  372. void __regargs SubDivide(x1,y1,x2,y2)
  373. long x1,y1,x2,y2;
  374. {
  375.  long t1,t2,t3,t4;
  376.  ULONG signals,v;
  377.  struct IntuiMessage *message;
  378.  long x,y,class,code;
  379.  APTR object;
  380.  UWORD d;
  381.  
  382.  if (((x2-x1)<2L) && ((y2-y1)<2L))
  383.   return;
  384.  if ( (message = (struct IntuiMessage *)
  385.     GetMsg(wG->UserPort) ))
  386.   {
  387.     class = message->Class;
  388.     code = message->Code;
  389.     object = message->IAddress;  /* Gadget */
  390.     ReplyMsg((struct Message *)message);
  391.     if ( class == MENUPICK )    /* MenuItems */
  392.      HandleEvent((APTR)ItemAddress(&MenuList1,code));
  393.     else if (class = VANILLAKEY)
  394.      {
  395.           if ((code == 'c')||(code == 'C'))
  396.        {
  397.         CycleColors();
  398.        }
  399.           else
  400.            {
  401.         d = 0;
  402.         while(!d)
  403.          {
  404.           signals = Wait(WINDOWSIGNAL);
  405.           if (signals & WINDOWSIGNAL)
  406.            while ((message = (struct IntuiMessage *)
  407.                   GetMsg(wG->UserPort)))
  408.             {
  409.              class = message->Class;
  410.              ReplyMsg((struct Message *)message);
  411.              if (class == VANILLAKEY)
  412.               d = 1;
  413.             }
  414.          }
  415.            }
  416.      }
  417.   }
  418.  if (done)
  419.   return;
  420.  x = (x1+x2)>>1;
  421.  y = (y1+y2)>>1;
  422.  if (!ReadPix(x,y))
  423.   {
  424.    t1 = unmap(ReadPix(x1,y1));
  425.    t2 = unmap(ReadPix(x2,y1));
  426.    t3 = unmap(ReadPix(x2,y2));
  427.    t4 = unmap(ReadPix(x1,y2));
  428.    v = ((t1+t2+t3+t4)>>2);
  429.    v = maparray[v];
  430.    FastPix(x,y,v);
  431.   }
  432.  adjust(x1,y1,x,y1,x2,y1);
  433.  adjust(x2,y1,x2,y,x2,y2);
  434.  adjust(x1,y2,x,y2,x2,y2);
  435.  adjust(x1,y1,x1,y,x1,y2);
  436.  SubDivide(x1,y1,x,y);
  437.  SubDivide(x,y1,x2,y);
  438.  SubDivide(x,y,x2,y2);
  439.  SubDivide(x1,y,x,y2);
  440. }
  441.  
  442. void DoAbout()
  443. {
  444.  struct IntuiMessage *message;
  445.  struct Window *wG3;
  446.  
  447.  if (!(wG3 = OpenWindow(&NewWindowStructure3)))
  448.  {
  449.   DisplayBeep(0L);
  450.   return;
  451.  }
  452.  PrintIText(wG3->RPort,&IText4,0L,0L);
  453.  WaitPort(wG3->UserPort);
  454.  while(message = (struct IntuiMessage *)GetMsg(wG3->UserPort))
  455.   ReplyMsg((struct Message *)message);
  456.  CloseWindow(wG3);
  457. }
  458.  
  459. void __regargs HandleEvent(object)
  460. APTR object;
  461. {
  462.   if (object == (APTR)&MenuItem1) { DoAbout(); return; }
  463.   if (object == (APTR)&MenuItem2) { DoQuit(); return; }
  464. }
  465. #define HANDLEEVENT HandleEvent
  466.  
  467. /* end of PowerWindows source generation */
  468.  
  469.  
  470.  
  471. void DoQuit()
  472. {
  473.  done = TRUE;
  474. }
  475.  
  476. /* end of PowerWindows source generation */
  477.  
  478.  
  479. void main(void);
  480. void main()
  481. {
  482.  int i;
  483. #ifdef DEBUG
  484. int d;
  485. #endif
  486.     ULONG code;
  487.     ULONG class;
  488.     APTR object;
  489.     ULONG signals;
  490.     struct IntuiMessage *message;    /* the message the IDCMP sends us */
  491.  
  492. #ifdef CPU020
  493.  
  494.  struct ExecBase **execbaseptr=(struct ExecBase **)4L;
  495.  UWORD cpuid;
  496.  struct ExecBase *execbase;
  497.  
  498.  execbase = *execbaseptr;
  499.  cpuid = execbase->AttnFlags;
  500.  if (!(cpuid & AFF_68020))
  501.   {
  502.    exit(0);
  503.   }
  504. #endif
  505.  
  506.         nplanes = DEPTH - 1;
  507.  
  508. #ifdef DEBUG
  509. for(d=0;d<64;d++)temparray[d] = 0;
  510. #endif
  511.     if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 33L)))
  512.          {
  513.            exit(0);
  514.          }
  515.     if(!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 33L)))
  516.          {
  517.            CloseLibrary((struct Library *)IntuitionBase);
  518.            exit(0);
  519.          }
  520.         if (!(myTextFont = OpenFont(&TOPAZ80)))
  521.          {
  522.           CloseLibrary((struct Library *)GfxBase);
  523.           CloseLibrary((struct Library *)IntuitionBase);
  524.           exit(0);
  525.          }
  526.     if (!(sC = OpenScreen(&NewScreenStructure)))
  527.          {
  528.           CloseFont(myTextFont);
  529.           CloseLibrary((struct Library *)GfxBase);
  530.           CloseLibrary((struct Library *)IntuitionBase);
  531.           exit(0);
  532.          }
  533.     LoadRGB4(&(sC->ViewPort),Palette,PaletteColorCount);
  534.     NewWindowStructure3.Screen = NewWindowStructure1.Screen = sC;
  535.     wG = OpenWindow(&NewWindowStructure1);    /* open the window */
  536.     if ( wG == NULL )
  537.     {
  538.       CloseScreen(sC);
  539.           CloseFont(myTextFont);
  540.           CloseLibrary((struct Library *)GfxBase);
  541.           CloseLibrary((struct Library *)IntuitionBase);
  542.           exit(0);
  543.     }
  544.     rpG = wG->RPort;    /* get a rastport pointer for the window */
  545.     SetFont(rpG,myTextFont);
  546.     SetMenuStrip(wG,&MenuList1);    /* attach any Menu */
  547.         SetDrMd(rpG,JAM1);
  548.         for(i=0;i<DEPTH;i++)
  549.          bp[i] = wG->RPort->BitMap->Planes[i];
  550.         ytable[0] = 0;
  551.     for(i=1;i<HEIGHT;i++)
  552.      ytable[i] = ytable[i-1] + rowoffset;
  553.         seed = time(0L);
  554.         signals = (randu2(63)) + 1L;
  555.         FastPix(0L,11L,signals);
  556.         signals = (randu2(63)) + 1L;
  557.         FastPix(319L,11L,signals);
  558.         signals = (randu2(63)) + 1L;
  559.         FastPix(319L,HEIGHT-1L,signals);
  560.         signals = (randu2(63)) + 1L;
  561.         FastPix(0L,HEIGHT-1L,signals);
  562.         SubDivide(0L,11L,319L,HEIGHT-1L);
  563.     DisplayBeep(0L);
  564.     while(!done)
  565.     {
  566.         signals = Wait(WINDOWSIGNAL);
  567.         if (signals & WINDOWSIGNAL)
  568.             while( (message = (struct IntuiMessage *)
  569.                 GetMsg(wG->UserPort) ) != NULL)
  570.             {
  571.                 class = message->Class;
  572.                 code = message->Code;
  573.                 object = message->IAddress;  /* Gadget */
  574.                 ReplyMsg((struct Message *)message);
  575.                 if ( class == MENUPICK )    /* MenuItems */
  576.                  HandleEvent((APTR)ItemAddress(&MenuList1,code));
  577.                 else if (class = VANILLAKEY)
  578.                  {
  579.                       if ((code == 'c')||(code == 'C'))
  580.                    {
  581.                     CycleColors();
  582.                    }
  583.                  }
  584.             }
  585.     }
  586.         CloseWindow(wG);
  587.         CloseFont(myTextFont);
  588.         CloseScreen(sC);
  589.         CloseLibrary((struct Library *)GfxBase);
  590.         CloseLibrary((struct Library *)IntuitionBase);
  591. #ifdef DEBUG
  592. for(d=0;d<64;d++)printf("temp[%d] = %d\n",d,temparray[d]);
  593. #endif
  594. }
  595.